package com.springbootx.mybatis.config.transactional;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import javax.sql.DataSource;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * <p>存放一个@MoreTramsaction的所有连接情况</p>
 *
 * @author Tony.niu (hystrix0779@yeah.net)
 **/
@Setter
@Getter
@Builder
public class Copy {
    private boolean tranSwitch;
    private IsolationLevel isolationLevel;
    private ConcurrentHashMap<String,Map<String, ConnectWarp>> connection;
    private Map<Object, DataSource> resolvedDataSources;
    private String currentMethod;
    private String mainMethod;
    private int mapperCount;

    public synchronized void addCount(){
        mapperCount++;
    }
    public synchronized int getCount(){
        return mapperCount;
    }

}
